package IOBaseTest;

import java.io.*;

/**
 * Created by yexuan on 2018/3/14.
 * 键盘录入打印 (over结束)
 */
public class ReadIn {
    public static void main(String[] args) throws IOException{
        read_in2();
    }

    public static void read_in2() throws IOException{
//        InputStream in = System.in;
//        //将字节流转换为字符流
//        InputStreamReader isr = new InputStreamReader(in);
//        //提高效率，用缓冲流 ，调用readLine方法
//        BufferedReader br = new BufferedReader(isr);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  //键盘录入写法

//        OutputStream os = System.out;
//        OutputStreamWriter osw = new OutputStreamWriter(os);
//        BufferedWriter bw = new BufferedWriter(osw);
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

//        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("文件名")));  //录入到文件


        String buf = null;
        while((buf = br.readLine())!=null){
            if ("over".equals(buf))
                break;
//            System.out.println(buf.toUpperCase());
            bw.write(buf.toUpperCase());
            bw.newLine();
            bw.flush();
        }
        br.close();
    }

    public static void read_in1() throws IOException{
        InputStream in = System.in;
        StringBuilder sb = new StringBuilder();
        while (true){
            int c = in.read();
            if ((char)c == '\r')
                continue;
            if ((char)c == '\n'){
                String s = sb.toString();
                if(s.equals("over"))
                    break;
                else{
                    System.out.println(s.toUpperCase());
                    sb.delete(0,sb.length());     //删去缓冲区中原有的字段
                }
            }
            else
                sb.append((char)c)  ;
        }
    }

}
